package com.example.combination;

import android.animation.ObjectAnimator;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.AnticipateOvershootInterpolator;
import android.view.animation.BounceInterpolator;
import android.view.animation.CycleInterpolator;
import android.view.animation.OvershootInterpolator;
import android.view.animation.RotateAnimation;

/**
 * author：sunweihao
 * 创建时间：2021/1/8 21:46
 * Describe：是否显示工具类
 */
public class Tool2 {
    public static void hideView(ViewGroup view) {
//        view.setRotation();
//        view.setTranslationX();
        ObjectAnimator animator=ObjectAnimator.ofFloat(view,"rotation",0,180);
        animator.setDuration(500);
        view.setPivotX(view.getWidth()/2);
        view.setPivotY(view.getHeight());
        animator.start();

    }
    public static void hideView(ViewGroup view, int startOfTime) {
        ObjectAnimator animator=ObjectAnimator.ofFloat(view,"rotation",0,180);
        animator.setDuration(500);
        animator.setStartDelay(200);
        view.setPivotX(view.getWidth()/2);
        view.setPivotY(view.getHeight());
        animator.start();
    }
    public static void show(ViewGroup view) {
        ObjectAnimator animator=ObjectAnimator.ofFloat(view,"rotation",180,360);
        animator.setDuration(500);
        animator.setInterpolator(new BounceInterpolator());
//        animator.setInterpolator(new AccelerateDecelerateInterpolator());
//        animator.setInterpolator(new AnticipateOvershootInterpolator());
//        animator.setInterpolator(new OvershootInterpolator());
        view.setPivotX(view.getWidth()/2);
        view.setPivotY(view.getHeight());
//        view.setRotationX(view.getX()/2);
//        view.setRotationY(view.getHeight());
        animator.start();
    }


}
